import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/special_list/process_nodes_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/role_personnel_entity.dart';


ProcessNodesEntity $ProcessNodesEntityFromJson(Map<String, dynamic> json) {
  final ProcessNodesEntity processNodesEntity = ProcessNodesEntity();
  final String? appRoutingAddress = jsonConvert.convert<String>(json['appRoutingAddress']);
  if (appRoutingAddress != null) {
    processNodesEntity.appRoutingAddress = appRoutingAddress;
  }
  final int? childrenControlType = jsonConvert.convert<int>(json['childrenControlType']);
  if (childrenControlType != null) {
    processNodesEntity.childrenControlType = childrenControlType;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    processNodesEntity.createBy = createBy;
  }
  final String? approvalResult = jsonConvert.convert<String>(json['approvalResult']);
  if (approvalResult != null) {
    processNodesEntity.approvalResult = approvalResult;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    processNodesEntity.createDate = createDate;
  }
  final String? formId = jsonConvert.convert<String>(json['formId']);
  if (formId != null) {
    processNodesEntity.formId = formId;
  }
  final String? iconAddress = jsonConvert.convert<String>(json['iconAddress']);
  if (iconAddress != null) {
    processNodesEntity.iconAddress = iconAddress;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    processNodesEntity.id = id;
  }
  final String? nodeDescription = jsonConvert.convert<String>(json['nodeDescription']);
  if (nodeDescription != null) {
    processNodesEntity.nodeDescription = nodeDescription;
  }
  final String? nodeId = jsonConvert.convert<String>(json['nodeId']);
  if (nodeId != null) {
    processNodesEntity.nodeId = nodeId;
  }
  final String? nodeName = jsonConvert.convert<String>(json['nodeName']);
  if (nodeName != null) {
    processNodesEntity.nodeName = nodeName;
  }
  final String? nodeNumber = jsonConvert.convert<String>(json['nodeNumber']);
  if (nodeNumber != null) {
    processNodesEntity.nodeNumber = nodeNumber;
  }
  final int? nodeType = jsonConvert.convert<int>(json['nodeType']);
  if (nodeType != null) {
    processNodesEntity.nodeType = nodeType;
  }
  final int? parentControlType = jsonConvert.convert<int>(json['parentControlType']);
  if (parentControlType != null) {
    processNodesEntity.parentControlType = parentControlType;
  }
  final String? pid = jsonConvert.convert<String>(json['pid']);
  if (pid != null) {
    processNodesEntity.pid = pid;
  }
  final String? processEncoding = jsonConvert.convert<String>(json['processEncoding']);
  if (processEncoding != null) {
    processNodesEntity.processEncoding = processEncoding;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    processNodesEntity.updateBy = updateBy;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    processNodesEntity.updateDate = updateDate;
  }
  final List<RolePersonnelEntity>? userIds = (json['userIds'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<RolePersonnelEntity>(e) as RolePersonnelEntity).toList();
  if (userIds != null) {
    processNodesEntity.userIds = userIds;
  }
  final List<RolePersonnelEntity>? rtUserProcesses = (json['rtUserProcesses'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<RolePersonnelEntity>(e) as RolePersonnelEntity).toList();
  if (rtUserProcesses != null) {
    processNodesEntity.rtUserProcesses = rtUserProcesses;
  }
  final String? webRoutingAddress = jsonConvert.convert<String>(json['webRoutingAddress']);
  if (webRoutingAddress != null) {
    processNodesEntity.webRoutingAddress = webRoutingAddress;
  }
  final bool? startingCanChanged = jsonConvert.convert<bool>(json['startingCanChanged']);
  if (startingCanChanged != null) {
    processNodesEntity.startingCanChanged = startingCanChanged;
  }
  final String? rejectNodeId = jsonConvert.convert<String>(json['rejectNodeId']);
  if (rejectNodeId != null) {
    processNodesEntity.rejectNodeId = rejectNodeId;
  }
  final String? userTypeName = jsonConvert.convert<String>(json['userTypeName']);
  if (userTypeName != null) {
    processNodesEntity.userTypeName = userTypeName;
  }
  final int? executableOrNot = jsonConvert.convert<int>(json['executableOrNot']);
  if (executableOrNot != null) {
    processNodesEntity.executableOrNot = executableOrNot;
  }
  final String? rtemplateId = jsonConvert.convert<String>(json['rtemplateId']);
  if (rtemplateId != null) {
    processNodesEntity.rtemplateId = rtemplateId;
  }
  final String? signatureAddress = jsonConvert.convert<String>(json['signatureAddress']);
  if (signatureAddress != null) {
    processNodesEntity.signatureAddress = signatureAddress;
  }
  final String? reviewComments = jsonConvert.convert<String>(json['reviewComments']);
  if (reviewComments != null) {
    processNodesEntity.reviewComments = reviewComments;
  }
  final String? executorBy = jsonConvert.convert<String>(json['executorBy']);
  if (executorBy != null) {
    processNodesEntity.executorBy = executorBy;
  }
  final String? executorById = jsonConvert.convert<String>(json['executorById']);
  if (executorById != null) {
    processNodesEntity.executorById = executorById;
  }
  final String? executorDate = jsonConvert.convert<String>(json['executorDate']);
  if (executorDate != null) {
    processNodesEntity.executorDate = executorDate;
  }
  return processNodesEntity;
}

Map<String, dynamic> $ProcessNodesEntityToJson(ProcessNodesEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['appRoutingAddress'] = entity.appRoutingAddress;
  data['childrenControlType'] = entity.childrenControlType;
  data['createBy'] = entity.createBy;
  data['approvalResult'] = entity.approvalResult;
  data['createDate'] = entity.createDate;
  data['formId'] = entity.formId;
  data['iconAddress'] = entity.iconAddress;
  data['id'] = entity.id;
  data['nodeDescription'] = entity.nodeDescription;
  data['nodeId'] = entity.nodeId;
  data['nodeName'] = entity.nodeName;
  data['nodeNumber'] = entity.nodeNumber;
  data['nodeType'] = entity.nodeType;
  data['parentControlType'] = entity.parentControlType;
  data['pid'] = entity.pid;
  data['processEncoding'] = entity.processEncoding;
  data['updateBy'] = entity.updateBy;
  data['updateDate'] = entity.updateDate;
  data['userIds'] = entity.userIds?.map((v) => v.toJson()).toList();
  data['rtUserProcesses'] = entity.rtUserProcesses?.map((v) => v.toJson()).toList();
  data['webRoutingAddress'] = entity.webRoutingAddress;
  data['startingCanChanged'] = entity.startingCanChanged;
  data['rejectNodeId'] = entity.rejectNodeId;
  data['userTypeName'] = entity.userTypeName;
  data['executableOrNot'] = entity.executableOrNot;
  data['rtemplateId'] = entity.rtemplateId;
  data['signatureAddress'] = entity.signatureAddress;
  data['reviewComments'] = entity.reviewComments;
  data['executorBy'] = entity.executorBy;
  data['executorById'] = entity.executorById;
  data['executorDate'] = entity.executorDate;
  return data;
}

extension ProcessNodesEntityExtension on ProcessNodesEntity {
  ProcessNodesEntity copyWith({
    String? appRoutingAddress,
    int? childrenControlType,
    String? createBy,
    String? approvalResult,
    String? createDate,
    String? formId,
    String? iconAddress,
    String? id,
    String? nodeDescription,
    String? nodeId,
    String? nodeName,
    String? nodeNumber,
    int? nodeType,
    int? parentControlType,
    String? pid,
    String? processEncoding,
    String? updateBy,
    String? updateDate,
    List<RolePersonnelEntity>? userIds,
    List<RolePersonnelEntity>? rtUserProcesses,
    String? webRoutingAddress,
    bool? startingCanChanged,
    String? rejectNodeId,
    String? userTypeName,
    int? executableOrNot,
    String? rtemplateId,
    String? signatureAddress,
    String? reviewComments,
    String? executorBy,
    String? executorById,
    String? executorDate,
  }) {
    return ProcessNodesEntity()
      ..appRoutingAddress = appRoutingAddress ?? this.appRoutingAddress
      ..childrenControlType = childrenControlType ?? this.childrenControlType
      ..createBy = createBy ?? this.createBy
      ..approvalResult = approvalResult ?? this.approvalResult
      ..createDate = createDate ?? this.createDate
      ..formId = formId ?? this.formId
      ..iconAddress = iconAddress ?? this.iconAddress
      ..id = id ?? this.id
      ..nodeDescription = nodeDescription ?? this.nodeDescription
      ..nodeId = nodeId ?? this.nodeId
      ..nodeName = nodeName ?? this.nodeName
      ..nodeNumber = nodeNumber ?? this.nodeNumber
      ..nodeType = nodeType ?? this.nodeType
      ..parentControlType = parentControlType ?? this.parentControlType
      ..pid = pid ?? this.pid
      ..processEncoding = processEncoding ?? this.processEncoding
      ..updateBy = updateBy ?? this.updateBy
      ..updateDate = updateDate ?? this.updateDate
      ..userIds = userIds ?? this.userIds
      ..rtUserProcesses = rtUserProcesses ?? this.rtUserProcesses
      ..webRoutingAddress = webRoutingAddress ?? this.webRoutingAddress
      ..startingCanChanged = startingCanChanged ?? this.startingCanChanged
      ..rejectNodeId = rejectNodeId ?? this.rejectNodeId
      ..userTypeName = userTypeName ?? this.userTypeName
      ..executableOrNot = executableOrNot ?? this.executableOrNot
      ..rtemplateId = rtemplateId ?? this.rtemplateId
      ..signatureAddress = signatureAddress ?? this.signatureAddress
      ..reviewComments = reviewComments ?? this.reviewComments
      ..executorBy = executorBy ?? this.executorBy
      ..executorById = executorById ?? this.executorById
      ..executorDate = executorDate ?? this.executorDate;
  }
}
